// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
// then press Enter. You can now see whitespace characters in your code.
public class Main {
    public static void main(String[] args) {
        System.out.println(firstUniqChar("abcdefghijklmn"));
    }

    public static int firstUniqChar(String s) {
        int[] array = new int[26];
        for(int i = 0; i < s.length(); i++){
            array[s.charAt(i)-'a']++;
        }
        for(int j = 0; j < s.length(); j++){
            if(array[j+s.charAt(j)-'a']==1){
                return j;
            }
        }
        return -1;
    }
}